﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using ProdService;
using System.Diagnostics;
using UI.Filters;
using ViewModels.JsonResult;
using ViewModels.User;
using static Global.Const;

namespace UI.Controllers
{
    public class UserController : BaseController
    {
        private UserService userService;
        private ContactService contactService;
        public UserController(UserService userService, ContactService contactService)
        {
            this.contactService = contactService;
            this.userService = userService;
        }

        public IActionResult Register(string ic)
        {
            //已经登录的用户跳转页面
            return View(new RegisterModel { InviteCode = ic });
        }

        public PartialViewResult _InviteCode() 
        {
            return PartialView(userService.GetInviteCode());
        }

        //TODO：是不是应该也能够ViewComponent实现？
        [TypeFilter(typeof(NeedLogon))]
        public IActionResult HomePage(int? id)
        {
            return View();
        }
    }
}